/***************************************************************************
 *   Copyright (C) 2008 by joker   *
 *   joker@arcturus.pet.cyric.tohoku.ac.jp   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef RPEM3D_H
#define RPEM3D_H

#include "menu.h"

#include <qevent.h>

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

int open_shm ( char *shmf, bool *first );
int cloes_shm ( void );
int put_shm ( int code, size_t offset );
int get_shm ( int *code, size_t offset );
void* get_shm_addr ( size_t offset );
int close_shm();

//#include <kmainwindow.h>

/**
 * @short Application Main Window
 * @author joker <joker@regulus.pet.cyric.tohoku.ac.jp>
 * @version 0.1
 */


//class rPem3D : public KMainWindow
//class rPem3D : public QMainWindow
class rPem3D : public Form
{
		Q_OBJECT

	public:
		rPem3D ( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
		~rPem3D();
		/*$PUBLIC_FUNCTIONS$*/
void setenvfloat(char const *name, float value);
void setenvint(char const *name, int value);
void setenvintL(char const *name, long int value);
int runscr ( char const *com, char const *arg="", int mode=0);
void setStudyPart();
void showLogo(bool on);
void unsetDbEnv(void);
void fixRunId(bool fix);
void clearEnv();
		void drawColbar(void);
		void plog ( QString mess, char const *col="black" , int level=0);
		void plogf ( QString mess);
		void printScanInfo();
		void stopPrompter();
		void setPalette ( int ip );
		void promptRecal();
		void recalimg();
		void scanDone ( int code );
		void scanStart ( int code );
		void reconDone ( int code );
		void showStime ( bool ok );
		void showLtime ( bool ok );
		void showRecon(bool ok);
		void showProg ( bool ok ,int totalsteps);
		void showScanGrp ( bool ok );
		void showStat();
		void cleStat();
		void debug ( QString mess );
		void writeHist(void);//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
		int fhistok();
		void startRecon();
		int checkReconStat();
		void timerStart ( QTimer * t, int ms );
		void clePaint();
		void exportdatetime();
		void exportdatadir();
		void exportdatafile();
		void timerStop(QTimer *t);
void reslice(void);

	public slots:
		/*$PUBLIC_SLOTS$*/
		virtual void itrSlot();
		virtual void polSlot();
		virtual void progSlot();
		virtual void killReconSlot();
		virtual void viewImgSlot();
		virtual void imageSlot();
		virtual void propSlot();
		virtual void startReconSlot();
		virtual void abortSlot();
		virtual void startSlot();
		virtual void colSlot();
		virtual void zSlot();
		virtual void zLblSlot();
		virtual void dbSlot();
		virtual void cleidSlot();
		virtual void autoidSlot();
		virtual void palSlot();
		virtual void zPressSlot();
		virtual void zReleaseSlot();
    virtual void updateSlot();
    virtual void autoUpdateSlot();
    virtual void updateSecSlot();
    virtual void heightSlot();
    virtual void datadirSlot();
    virtual void loglevelSlot();
virtual void reconlogSlot();
    virtual void popSlot();
    virtual void addtimeSlot();
    virtual void runidSlot();
    virtual void callrpvSlot();

	protected:
		/*$PROTECTED_FUNCTIONS$*/
		void   paintEvent ( QPaintEvent *event );
		void   closeEvent ( QCloseEvent *event);
		void mouseReleaseEvent(QMouseEvent *e);
//	    void   paintEvent( QPaintEvent *);

	protected slots:
void showAbout();
		/*$PROTECTED_SLOTS$*/

};

#endif


